var app = getApp();

Component({
        properties: {
                textOne: {
                        type: String
                },
                inMenuItemData: {
                        type: Array
                }
        },

        data: {
                baseUrl: app.globalData.baseUrl,
                selectItemId: 0,
        },

        attached() {
                // let tempId = this.data.inMenuItemData[0].id
                // this.setData({
                //         selectItemId: tempId
                // })

                let _self = this;
                // setTimeout(() => {
                //         _self.triggerEvent("onMenuItemChange", {
                //                 selectItemId: _self.data.selectItemId
                //         });
                // }, 500);

        },

        methods: {
                setDefaultItem(index) {
                        let tempId = this.data.inMenuItemData[index].id
                        this.setData({
                                selectItemId: tempId
                        })

                        this.triggerEvent("onMenuItemChange", {
                                selectItemId: this.data.selectItemId
                        });  
                },

                menuItemClick(e) {
                        console.log(e.currentTarget.dataset.data)
                        this.setData({
                                selectItemId: e.currentTarget.dataset.data
                        })

                        this.triggerEvent("onMenuItemChange", {
                                selectItemId: this.data.selectItemId
                        });

                },
        },
})